#!/bin/bash
# Copyright (C) 2023 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

set -e

REPO_PATH="$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" >/dev/null 2>&1 && pwd)"

cd "$REPO_PATH/packages/cmk-frontend"
./run --build # we just want to install the dependencies, but there is no target for that

# npm-groovy-lint installs AdoptOpenJDK, which would be downloaded via IPv6
NODE_OPTIONS="--dns-result-order=ipv4first" npx --no npm-groovy-lint -- "$REPO_PATH"/buildscripts/scripts/**/*.groovy "$@" --noserver
